package AVLTree.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AVLTree {
    private int val,h;
    private AVLTree left,right;

    /**
     * 更新高度方法
     * @return
     */
    public int getHeight() {
        int lh = left != null ? left.h : 0;
        int rh = right != null ? right.h : 0;
        return Math.max(lh, rh) + 1;
    }
}
